*Load data
use "C:\Users\abrah\Dropbox\Fear and coordination\11_JEPS_Replication_Files\01_Data\Data for Analyses in Stata\data_stata.dta", clear
 

*Drop periods that had a coding mistake
recode action_i (0=.) (1=.) if Period==16 & Date=="190418_1853"
recode action_i (0=.) (1=.) if Period==11 & Date=="190425_1928"

set scheme s1mono

*Analysis for rounds played with a human with uncertainty
reg action_i c.Treatment##c.spread if Type==3, cluster(Session_Number)
eststo I
margins, dydx(Treatment) at(spread=(1.5(.5)3.5))

marginsplot, yline(0) xtitle("Payoff difference R-(-c)") ytitle("")

*Analysis for Computer Rounds
reg action_i c.Treatment##c.spread if Type==1, cluster(Session_Number)
eststo II
margins, dydx(Treatment) at(spread=(1.5(.5)3.5))

marginsplot, yline(0) xtitle("Payoff difference R-(-c)") ytitle("")



*Analysis for rounds played with a human, no uncertainty
reg action_i c.Treatment##c.spread if Type==2, cluster(Session_Number)
eststo III
margins, dydx(Treatment) at(spread=(1.5(.5)3.5))

marginsplot, yline(0) xtitle("Payoff difference R-(-c)") ytitle("")


esttab I II III, cells(b(star fmt(3)) se(par fmt(3))) stats(N r2, labels("Observartions" "R$^2$") fmt(2)) starlevel(* .10 ** .05 *** .01) replace tex nolz label noabb wrap varwidth(50) mtitles
